package com.sim.contact.tool.contacts;


import android.content.ContentResolver;
import android.content.Intent;
import android.os.Build;

public abstract class ContactAPI {
private static ContactAPI api;
     
     public static ContactAPI getAPI() {
         if (api == null) {
             String apiClass;
             if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.ECLAIR) {
                 apiClass = "com.highercollaboration.android.ContactAPI.ContactAPISdk5";
             } else {
                 apiClass = "com.highercollaboration.android.ContactAPI.ContactAPISdk3";
             }
             
             try {
                 Class<? extends ContactAPI> realClass = Class.forName(apiClass).
                     asSubclass(ContactAPI.class);
                 api = realClass.newInstance();
             } catch (Exception e) {
                 throw new IllegalStateException(e);
             }
             
         }
         return api;
     }
     
     public abstract Intent getContactIntent();
     
     public abstract ContactList newContactList();
     
     public abstract ContentResolver getCr();
     public abstract void setCr(ContentResolver cr);
     
}